﻿/*******************************************************************************
 * AAEngine
 * Copyright (c) 2010 Mike Jarosch
 *
 * Original source PushButton Engine:
 * Copyright (C) 2009 PushButton Labs, LLC
 * For more information see http://www.pushbuttonengine.com
 *
 * This file is licensed under the terms of the MIT license, which is included
 * in the "MIT License.txt" file at the root directory of this SDK.
 ******************************************************************************/

using System;
using AAEngine.Engine.Debug;

namespace AAEngine.Engine.Resources
{
    public abstract class Resource : IDisposable
    {
        private string _filename;
        private int _referenceCount;

        public string Filename 
        {
            get { return _filename; }
            set
            {
                if (_filename != null)
                {
                    Logger.Warn(this, "Filename", "Can't change the filename of a resource once it has been set.");
                    return;
                }
                _filename = value;
            }
        }

        public int ReferenceCount
        {
            get { return _referenceCount; }
        }

        public void IncrementReferenceCount()
        {
            _referenceCount++;
        }

        public void DecrementReferenceCount()
        {
            _referenceCount--;
        }

        public virtual void Initialize(object data)
        {
        }

        public virtual void Dispose()
        {
        }
    }
}
